/*
 * @Author: lclangcheng
 * @Date: 2018-11-02 10:24:09
 * @Last Modified by: lclangcheng
 * @Last Modified time: 2018-11-12 15:35:43
 */
'use strict'

class CustomError extends Error {
  constructor (status = 400, ...params) {
    // Pass remaining arguments (including vendor specific ones) to parent constructor
    super(...params)

    // Maintains proper stack trace for where our error was thrown (only available on V8)
    if (Error.captureStackTrace) {
      Error.captureStackTrace(this, CustomError)
    }

    // Custom debugging information
    this.status = status
    this.date = Date.now()
  }
}

module.exports = CustomError
